<?php
	$controller = $_GET['controller']?$_GET['controller']:'create';
	$action = $_GET['action'];
	
	require_once("$controller.php");
	$obj = new $controller();
	
	if($action != null && method_exists($obj, $action)){
		$obj->$action();
	}
?>
<html>
	<head>
		<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
		
		<title>iRobot Create Manage tool</title>
		
		<!-- Styles -->
		<link type="text/css" rel="stylesheet" href="css/style.css" />
		<?php
			foreach($obj->css as $css){
				echo "\t\t<link type='text/css' rel='stylesheet' href='$css' />\n"; 
			}
		?>
		
		<!-- Javascripts -->
		<script type="text/javascript" src="js/jquery-1.5.1.min.js"></script>
		<?php
			foreach($obj->js as $js){
				echo "\t\t<script type='text/javascript' src='$js'></script>\n"; 
			}
		?>
		<?php $obj->echo_javascript();?>
		
	</head>
	<body onload="<?php echo $obj->onload;?>">
		<div class="contenido">
			<div class="cabecera">
				<div class="logo">
					<h1>BeagleROSCreate</h1>
				</div>
				<div class="menu">
					<?php require_once('menu.php');?>
				</div>			
			</div>
			<div class="cuerpo">
				<div class="izq">
					<?php $obj->echo_izq();?>
				</div>
				<div class="centro">
					<?php $obj->echo_centro();?>
				</div>
				<div class="der">
					<?php $obj->echo_der();?>
				</div>
			</div>
		</div>
	</body>
</html>